define(["jquery","bbcare"],function ($,$bb) {
    var servers={};
    var URL = $bb.baseUrl("department")+"followup/service";
    /*
    * 获取运动曲线：
    * */
    servers.getMotionCurData = function(params,callback,otherParams){
        $bb.ajax({
            url: URL + "/nutrition/activities/list",
            data: JSON.stringify({
                data: params
            }),
            success: function (data) {
                if(data.success){
                    callback(data,otherParams);
                }
            }
        });
    };
    /*
    * 获取血糖曲线；
    * */
    servers.getBGCurData = function(params,callback,otherParams){
        $bb.ajax({
            url: URL + "/nutrition/bloodsugar/userRecords",
            data: JSON.stringify({
                data: params
            }),
            success: function (data) {
                if(data.success){
                    callback(data,otherParams);
                }
            }
        });
    };
    /*
     * 设备绑定：
     * */
    servers.equipBind = function(params,callback,otherParams){
        $bb.ajax({
            url: URL + "/nutrition/device/binding",
            data: JSON.stringify({
                data: params
            }),
            success: function (data) {
                if(data.success){
                    callback(data,otherParams);
                }else{
                    $bb.toastShow(data.msg,1500);
                }
            }
        });
    };
    /*
     * 设备解绑：
     * */
    servers.equipUnbind = function(params,callback,otherParams){
        $bb.ajax({
            url: URL + "/nutrition/device/unbind",
            data: JSON.stringify({
                data: params
            }),
            success: function (data) {
                if(data.success){
                    callback(data,otherParams);
                }else{
                    $bb.toastShow(data.msg,1500);
                }
            }
        });
    };
    /*
     * 华米授权：
     * */
    servers.authority = function(params,callback,otherParams){
        $bb.ajax({
            url: URL + "/nutrition/authorization/geturl",
            data: JSON.stringify({
                data: params
            }),
            success: function (data) {
                if(data.success){
                    callback(data,otherParams);
                }else{
                    $bb.toastShow(data.msg);
                }
            }
        });
    };
    /*
    * 删除患者：
    * */
    servers.deletePatient = function(params){
        $bb.ajax({
            url: URL + "/patient/history/patientDel",
            data: JSON.stringify({
                data: params
            }),
            success: function (data) {
                params.callback(data);
            }
        });
    };
    /*
     * 获取随访任务id;
     * */
    servers.getTaskId = function(params,callback,otherParams){
        $bb.ajax({
            url: URL + "/patient/patientTaskListQuery",
            data:JSON.stringify({
                data : params
            }),
            success: function(data){
                if(data.success){
                    callback(data,otherParams);
                }
            }
        });
    };
    /*
     * 获取建档问卷和内容
     * */
    servers.getRecordQuestions = function(params,callback,otherParams){
        $bb.ajax({
            url: URL + "/patient/patientTaskContentDataQuery",
            data:JSON.stringify({
                data : params
            }),
            success: function(data){
                if(data.success){
                    callback(data,otherParams);
                }
            }
        });
    };

    return servers;
});